//============================================================================
// Name        : ms002.cpp
// Author      : Tadas
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <cmath>
#include "trapec.h"
#define PI 3.141592
using namespace std;

double f1(double x){
	double y = x*x*x*x*log(x + sqrt(x*x + 1));
	return y;
}

double f2(double x){
	double y = 0;
	if(x < 0.5){
		y = 10 * x;
	}
	if(x >= 0.5){
		y = (20 - 10*x)/3;
	}
	return y;
}

double f1a(double x){
	double y = x*x*x*x;
	return y;
}

double f2a(double x){
	double y = 5 - 50 / (PI*PI);
	double sum = 0;
	for(int i = 1; i <= 13; i = i + 2){
		sum += cos(PI*i*x)/(i*i);
	}
	return y;
}


void print_count(){
	cout << "Trapec panaudota: " << tcount << endl;
	tcount = 0;
	//s = 0;
}


int main() {
	cout << sizeof(int) << endl;
	
	/*
	cout << "f1a.t: " << sumTrapec(f1a, 0.0, 2.0) << endl;
	print_count();
	cout << "f1a.s: " << sumTrapecSyms(f1a, 0.0, 2.0) << endl;
	print_count();
	cout << "f1a.r: " << sumTrapecRondberg(f1a, 0.0, 2.0) << endl;
	print_count();
	
	cout << "f2a.t: " << sumTrapec(f2a, 0.0, 2.0) << endl;
	print_count();
	cout << "f2a.s: " << sumTrapecSyms(f2a, 0.0, 2.0) << endl;
	print_count();
	cout << "f2a.r: " << sumTrapecRondberg(f2a, 0.0, 2.0) << endl;
	print_count();
	*/
	cout << "f1.t: " << sumTrapec(f1, 0.0, 2.0) << endl;
	print_count();
	cout << "f1.s: " << sumTrapecSyms(f1, 0.0, 2.0) << endl;
	print_count();
	cout << "f1.r: " << sumTrapecRondberg(f1, 0.0, 2.0) << endl;
	print_count();
	
	cout << "f2.t: " << sumTrapec(f2, 0.0, 2.0) << endl;
	print_count();
	cout << "f2.s: " << sumTrapecSyms(f2, 0.0, 2.0) << endl;
	print_count();
	cout << "f2.r: " << sumTrapecRondberg(f2, 0.0, 2.0) << endl;
	print_count();
	return 0;
}


